// 接口管理
import Vue from 'vue'
import axios from 'axios'

// 配置axios根目录
axios.defaults.baseURL = 'http://203.195.181.208:8888'

Vue.prototype.Api = {
  getCarousel (params) {
    return axios.get('/api/getlunbo', params)
  },
  getGrids (params) {
    return axios.get('/api/grids', params)
  },
  getNewsList (params) {
    return axios.get('/api/getnewslist', params)
  },
  getNewsInfo (params) {
    return axios.get('/api/getnew/' + params)
  },
  getComments ({ id, page, pagesize = 3 }) {
    return axios.get(`/api/getcomments/${id}?$pageindex=${page}&limit${pagesize}`)
    // / api / getcomments /: artid ? pageindex = 1 & limit=3
  },
  postComment ({ id, content }) {
    return axios.post(`/api/postcomment/${id}`, { content })
  },
  getImgCategory (params) {
    return axios.get('/api/getimgcategory', params)
  },
  getImagesById (params) {
    return axios.get('/api/getimages/' + params)
  },
  getImageInfo (params) {
    return axios.get('/api/getimageInfo/' + params)
  },
  getThumimages (params) {
    return axios.get('/api/getthumimages/' + params)
  }
}
